﻿@model Rated.Website.Models.RatedItemListViewModel
<h2>
    My Listings</h2>
<div id="ratedItemListContainer" class="clearfix">
    @{
        foreach (var item in Model.Items)
        {
            // Dynamic Sections for AttributeTypes, we show all supported attribute types 
            // applicable to this ItemType, not just the ones that are assigned!
            var sections = Rated.Website.Helpers.RatedItemHelper.SupportedAttributeTypes(item.RatedItemTypeID.Value);          
        <div id="itemtabs" class="tabs smallerTabs">
            <ul>
                <li><a href="#itemDescription">Description</a></li>
                <li><a href="#itemLocation">Location</a></li>
                <li><a href="#itemImages">Images</a></li>
                <li><a href="#itemVideo">Video</a></li>
                <li><a href="#itemReviews">Reviews</a></li>
                @{
            foreach (var s in sections)
            {
                var href = "#" + s.Text.Replace(" ", "");
                
                    <li><a href="@href">@s.Text</a></li>
            
            }
                    
                }
            </ul>
            <div id="itemDescription" class="form">
                <form method="post" id="updateItemDescription" action="@Url.Action("UpdateDescription", "RatedItem")">
                @Html.HiddenFor(o => item.ID)
                <fieldset>
                    <ol>
                        <li class="clearfix">
                            <label>
                                Title</label>
                            @Html.TextBoxFor(o => item.Title, new { @class = "wide" })
                        </li>
                        <li class="clearfix">
                            <label>
                                Description</label>
                            @Html.TextAreaFor(o => item.Description, new { @class = "wide" })
                        </li>
                    </ol>
                    <button id="btnUpdateItemDescription" class="cta clearfix">
                        Update</button>
                </fieldset>
                </form>
            </div>
            <div id="itemLocation">
                @{Html.RenderPartial("Location", item);}
            </div>
            <div id="itemImages">
                Item Images
            </div>
            <div id="itemVideo">
                Item Video
            </div>
            <div id="itemReviews">
               @{Html.RenderPartial("itemReviews", item);}
            </div>
            @{
                  foreach (var s in sections)
                  {
                      var divId = s.Text.Replace(" ", "");
                
                    <div id="@divId">
                        @{Html.RenderPartial("Attribute", new Rated.Website.Models.RatedItemAttributeViewModel(item, s));}
                    </div>
                  }
            }
        </div>
        }
    }
</div>
